// 为了解析url，获取url的每个部分
// const url = require("url");

// console.log(url);

// const str = "https://www.baidu.com:3000/abc/qwe/asd/index.html?um=admin&pw=123456#top";

// console.log(url.parse( str, true ));

// const obj = {
//   protocol: 'https:',
//   slashes: true,
//   auth: null,
//   host: 'www.baidu.com:3000',
//   port: '3000',
//   hostname: 'www.baidu.com',
//   hash: '#top',
//   search: '?um=admin&pw=123456',
//   query: { um: 'admin', pw: '123456' },
//   pathname: '/abc/qwe/asd/index.html',
//   path: '/abc/qwe/asd/index.html?um=admin&pw=123456',
//   href: 'https://www.baidu.com:3000/abc/qwe/asd/index.html?um=admin&pw=123456#top'
// }
// console.log( url.format(obj) );

// ==========

const str = "https://www.baidu.com:3000/abc/qwe/asd/index.html?um=admin&pw=123456#top";
const url = new URL( str );

console.log(url);

console.log(url.searchParams);

console.log(url.searchParams.get("um"));
console.log(url.searchParams.get("pw"));
